#ifndef _VARIABLE_H_
#define _VARAIBLE_H_
//---------------------------------------------------------------------------------------
//char联合体

union	byte_def
{
	struct 
	{
		char	b0:1;
		char	b1:1;
		char	b2:1;
		char	b3:1;
		char	b4:1;
		char	b5:1;
		char	b6:1;
		char	b7:1;
	} bits;
	
	char	byte;
};

//----------------------------------------------------------------------------------------//
//存放位置要注意，低位在前，高位在后
//struct
//		{
//			unsigned char	RAM0:1;	//RAM0
//			unsigned char	RAM1:1;	//RAM1
//			unsigned char	RAM2:1;	//RAM2
//			......
//			unsigned char	RAMn :1;//RAMn
//		}byte;
//个各位定义要严格按照液晶图的脚位一一对应到RAM区否则会显示乱码
union		union_Display_RAM
{
	unsigned char							U8_LCD_DisplayBuffer[14];																			//LCD显示缓存
	struct
	{	
		struct
		{
			unsigned char		RAM_BUF000 :1;																											//RAM000
			unsigned char		RAM_BUF001 :1;                                                    	//RAM001
			unsigned char		RAM_BUF002 :1;                                                    	//RAM002
			unsigned char		RAM_BUF003 :1;                                                    	//RAM003
			unsigned char		RAM_BUF004 :1;                                                    	//RAM004
			unsigned char		RAM_BUF005 :1;                                                    	//RAM005
			unsigned char		RAM_BUF006 :1;                                                    	//RAM006
			unsigned char		RAM_BUF007 :1;																											//RAM007		
		}buffer_1_byte;            
		
		struct
		{
			unsigned char		RAM_BUF008 :1;																											//RAM008
			unsigned char		RAM_BUF009 :1;                                                    	//RAM009
			unsigned char		RAM_BUF010 :1;                                                    	//RAM010
			unsigned char		RAM_BUF011 :1;                                                    	//RAM011
			unsigned char		RAM_BUF012 :1;                                                    	//RAM012
			unsigned char		RAM_BUF013 :1;                                                    	//RAM013
			unsigned char		RAM_BUF014 :1;                                                    	//RAM014
			unsigned char		RAM_BUF015 :1;                                                    	//RAM015
		}buffer_2_byte;           
		
		struct
		{
			unsigned char		RAM_BUF016 :1;
			unsigned char		RAM_BUF017 :1;
			unsigned char		RAM_BUF018 :1;
			unsigned char		RAM_BUF019 :1;
			unsigned char		RAM_BUF020 :1;
			unsigned char		RAM_BUF021 :1;
			unsigned char		RAM_BUF022 :1;
			unsigned char		RAM_BUF023 :1;
		}buffer_3_byte;
		
		struct
		{
			unsigned char		RAM_BUF024 :1;
			unsigned char		RAM_BUF025 :1;
			unsigned char		RAM_BUF026 :1;
			unsigned char		RAM_BUF027 :1;
			unsigned char		RAM_BUF028 :1;
			unsigned char		RAM_BUF029 :1;
			unsigned char		RAM_BUF030 :1;
			unsigned char		RAM_BUF031 :1;
		}buffer_4_byte;
		
		struct
		{
			unsigned char		RAM_BUF032 :1;
			unsigned char		RAM_BUF033 :1;
			unsigned char		RAM_BUF034 :1;
			unsigned char		RAM_BUF035 :1;
			unsigned char		RAM_BUF036 :1;
			unsigned char		RAM_BUF037 :1;
			unsigned char		RAM_BUF038 :1;
			unsigned char		RAM_BUF039 :1;
		}buffer_5_byte;    

		struct             
		{                  
			unsigned char		RAM_BUF040 :1;
			unsigned char		RAM_BUF041 :1;
			unsigned char		RAM_BUF042 :1;
			unsigned char		RAM_BUF043 :1;
			unsigned char		RAM_BUF044 :1;
			unsigned char		RAM_BUF045 :1;
			unsigned char		RAM_BUF046 :1;
			unsigned char		RAM_BUF047 :1;
		}buffer_6_byte;    

		struct             
		{                  
			unsigned char		RAM_BUF048 :1;
			unsigned char		RAM_BUF049 :1;
			unsigned char		RAM_BUF050 :1;
			unsigned char		RAM_BUF051 :1;
			unsigned char		RAM_BUF052 :1;
			unsigned char		RAM_BUF053 :1;
			unsigned char		RAM_BUF054 :1;
			unsigned char		RAM_BUF055 :1;
		}buffer_7_byte;    

		struct             
		{                  
			unsigned char		RAM_BUF056 :1;
			unsigned char		RAM_BUF057 :1;
			unsigned char		RAM_BUF058 :1;
			unsigned char		RAM_BUF059 :1;
			unsigned char		RAM_BUF060 :1;
			unsigned char		RAM_BUF061 :1;
			unsigned char		RAM_BUF062 :1;
			unsigned char		RAM_BUF063 :1;
		}buffer_8_byte;    

		struct             
		{                  
			unsigned char		RAM_BUF064 :1;
			unsigned char		RAM_BUF065 :1;
			unsigned char		RAM_BUF066 :1;
			unsigned char		RAM_BUF067 :1;
			unsigned char		RAM_BUF068 :1;
			unsigned char		RAM_BUF069 :1;
			unsigned char		RAM_BUF070 :1;
			unsigned char		RAM_BUF071 :1;
		}buffer_9_byte;    

		struct             
		{                  
			unsigned char		RAM_BUF072 :1;
			unsigned char		RAM_BUF073 :1;
			unsigned char		RAM_BUF074 :1;
			unsigned char		RAM_BUF075 :1;
			unsigned char		RAM_BUF076 :1;
			unsigned char		RAM_BUF077 :1;
			unsigned char		RAM_BUF078 :1;
			unsigned char		RAM_BUF079 :1;
		}buffer_10_byte;   

		struct             
		{                  
			unsigned char		RAM_BUF080 :1;
			unsigned char		RAM_BUF081 :1;
			unsigned char		RAM_BUF082 :1;
			unsigned char		RAM_BUF083 :1;
			unsigned char		RAM_BUF084 :1;
			unsigned char		RAM_BUF085 :1;
			unsigned char		RAM_BUF086 :1;
			unsigned char		RAM_BUF087 :1;
		}buffer_11_byte;   

		struct             
		{                  
			unsigned char		RAM_BUF088 :1;
			unsigned char		RAM_BUF089 :1;
			unsigned char		RAM_BUF090 :1;
			unsigned char		RAM_BUF091 :1;
			unsigned char		RAM_BUF092 :1;
			unsigned char		RAM_BUF093 :1;
			unsigned char		RAM_BUF094 :1;
			unsigned char		RAM_BUF095 :1;
		}buffer_12_byte;   
		
		struct             
		{                  
			unsigned char		RAM_BUF096 :1;
			unsigned char		RAM_BUF097 :1;
			unsigned char		RAM_BUF098 :1;
			unsigned char		RAM_BUF099 :1;
			unsigned char		RAM_BUF100 :1;
			unsigned char		RAM_BUF101 :1;
			unsigned char		RAM_BUF102 :1;
			unsigned char		RAM_BUF103 :1;
		}buffer_13_byte;   

		struct             
		{                  
			unsigned char		RAM_BUF104 :1;
			unsigned char		RAM_BUF105 :1;
			unsigned char		RAM_BUF106 :1;
			unsigned char		RAM_BUF107 :1;
			unsigned char		RAM_BUF108 :1;
			unsigned char		RAM_BUF109 :1;
			unsigned char		RAM_BUF110 :1;
			unsigned char		RAM_BUF111 :1;
		}buffer_14_byte;
		
	}segments;

};//LCD_RAM_Buffer;

extern union	union_Display_RAM								LCD_RAM_Buffer;
//RAM0~7
#define			LCD_COM0_2A_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF000
#define			LCD_COM1_2B_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF001
#define			LCD_COM2_2C_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF002
#define			LCD_COM3_2D_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF003
#define			LCD_COM0_NC0_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF004	//NC
#define			LCD_COM1_1G_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF005	
#define			LCD_COM2_1F_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF006
#define			LCD_COM3_1E_Flag									LCD_RAM_Buffer.segments.buffer_1_byte.RAM_BUF007
//RAM8_15                                                                           
#define			LCD_COM0_1A_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF008
#define			LCD_COM1_1B_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF009
#define			LCD_COM2_1C_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF010
#define			LCD_COM3_1D_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF011
#define			LCD_COM0_T8_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF012	
#define			LCD_COM1_T7_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF013
#define			LCD_COM2_T6_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF014
#define			LCD_COM3_T5_Flag									LCD_RAM_Buffer.segments.buffer_2_byte.RAM_BUF015	//电机故障标识
//RAM16~23
#define			LCD_COM0_NC1_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF016	//NC
#define			LCD_COM1_T2_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF017
#define			LCD_COM2_NC2_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF018	//NC
#define			LCD_COM3_T4_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF019	//刹车标识
#define			LCD_COM0_SET_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF020		
#define			LCD_COM1_NC3_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF021	//NC
#define			LCD_COM2_NC4_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF022	//NC
#define			LCD_COM3_NC5_Flag									LCD_RAM_Buffer.segments.buffer_3_byte.RAM_BUF023	//NC
//RAM24~31
#define			LCD_COM0_NC6_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF024	//NC
#define			LCD_COM1_R6_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF025
#define			LCD_COM2_R5_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF026	
#define			LCD_COM3_R4_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF027
#define			LCD_COM0_R0_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF028	
#define			LCD_COM1_R1_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF029	
#define			LCD_COM2_R2_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF030	
#define			LCD_COM3_R3_Flag									LCD_RAM_Buffer.segments.buffer_4_byte.RAM_BUF031	

//RAM32~39
#define			LCD_COM0_NC7_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF032	//NC
#define			LCD_COM1_2G_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF033
#define			LCD_COM2_2F_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF034
#define			LCD_COM3_2E_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF035
#define			LCD_COM0_VOL_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF036		
#define			LCD_COM1_NC8_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF037	//NC
#define			LCD_COM2_NC9_Flag									LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF038	//NC
#define			LCD_COM3_NC10_Flag								LCD_RAM_Buffer.segments.buffer_5_byte.RAM_BUF039	//NC

//RAM40~47
#define			LCD_COM0_MPH_Flag									LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF040
#define			LCD_COM1_KMH_Flag									LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF041
#define			LCD_COM2_NC11_Flag								LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF042	//NC
#define			LCD_COM3_NC12_Flag								LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF043	//NC
#define			LCD_COM0_DIS_Flag									LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF044	
#define			LCD_COM1_ODO_Flag									LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF045
#define			LCD_COM2_NC13_Flag								LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF046	//NC
#define			LCD_COM3_NC14_Flag								LCD_RAM_Buffer.segments.buffer_6_byte.RAM_BUF047	//NC

//RAM48~55
#define			LCD_COM0_U1_Flag									LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF048
#define			LCD_COM1_U2_Flag									LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF049
#define			LCD_COM2_NC15_Flag								LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF050	//NC
#define			LCD_COM3_NC16_Flag								LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF051	//NC
#define			LCD_COM0_NC17_Flag								LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF052	//NC	
#define			LCD_COM1_3G_Flag									LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF053
#define			LCD_COM2_3F_Flag									LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF054
#define			LCD_COM3_3E_Flag									LCD_RAM_Buffer.segments.buffer_7_byte.RAM_BUF055

//RAM56~63
#define			LCD_COM0_3A_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF056
#define			LCD_COM1_3B_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF057
#define			LCD_COM2_3C_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF058
#define			LCD_COM3_3D_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF059
#define			LCD_COM0_NC18_Flag								LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF060	//NC	
#define			LCD_COM1_4G_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF061
#define			LCD_COM2_4F_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF062
#define			LCD_COM3_4E_Flag									LCD_RAM_Buffer.segments.buffer_8_byte.RAM_BUF063

//RAM64~71
#define			LCD_COM0_4A_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF064
#define			LCD_COM1_4B_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF065
#define			LCD_COM2_4C_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF066
#define			LCD_COM3_4D_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF067
#define			LCD_COM0_NC19_Flag								LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF068	//NC
#define			LCD_COM1_5G_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF069
#define			LCD_COM2_5F_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF070
#define			LCD_COM3_5E_Flag									LCD_RAM_Buffer.segments.buffer_9_byte.RAM_BUF071

//RAM72~79
#define			LCD_COM0_5A_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF072
#define			LCD_COM1_5B_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF073
#define			LCD_COM2_5C_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF074
#define			LCD_COM3_5D_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF075
#define			LCD_COM0_NC20_Flag								LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF076	//NC
#define			LCD_COM1_6G_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF077
#define			LCD_COM2_6F_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF078
#define			LCD_COM3_6E_Flag									LCD_RAM_Buffer.segments.buffer_10_byte.RAM_BUF079

//RAM80~87
#define			LCD_COM0_6A_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF080
#define			LCD_COM1_6B_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF081
#define			LCD_COM2_6C_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF082
#define			LCD_COM3_6D_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF083
#define			LCD_COM0_NC21_Flag								LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF084	//NC
#define			LCD_COM1_7G_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF085
#define			LCD_COM2_7F_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF086
#define			LCD_COM3_7E_Flag									LCD_RAM_Buffer.segments.buffer_11_byte.RAM_BUF087

//RAM88~95
#define			LCD_COM0_7A_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF088
#define			LCD_COM1_7B_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF089
#define			LCD_COM2_7C_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF090
#define			LCD_COM3_7D_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF091
#define			LCD_COM0_NC22_Flag								LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF092	//NC
#define			LCD_COM1_8G_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF093
#define			LCD_COM2_8F_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF094
#define			LCD_COM3_8E_Flag									LCD_RAM_Buffer.segments.buffer_12_byte.RAM_BUF095

//RAM96~103
#define			LCD_COM0_8A_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF096
#define			LCD_COM1_8B_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF097
#define			LCD_COM2_8C_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF098
#define			LCD_COM3_8D_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF099
#define			LCD_COM0_NC23_Flag								LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF100	//NC
#define			LCD_COM1_9G_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF101
#define			LCD_COM2_9F_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF102
#define			LCD_COM3_9E_Flag									LCD_RAM_Buffer.segments.buffer_13_byte.RAM_BUF103

//RAM104~111
#define			LCD_COM0_9A_Flag									LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF104
#define			LCD_COM1_9B_Flag									LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF105
#define			LCD_COM2_9C_Flag									LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF106
#define			LCD_COM3_9D_Flag									LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF107
#define			LCD_COM0_NC24_Flag								LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF108	//NC
#define			LCD_COM1_TIME_Flag								LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF109
#define			LCD_COM2_RPM_Flag									LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF110
#define			LCD_COM3_NC25_Flag								LCD_RAM_Buffer.segments.buffer_14_byte.RAM_BUF111	//NC
//----------------------------------------------------------------------------------------//

extern union		byte_def											FirstControllerSetAddr;										//控制器设置1
#define			FirstControllerSetByte						FirstControllerSetAddr.byte                 //
#define			ControllerCruiseChangeFlag				FirstControllerSetAddr.bits.b0          		//巡航切换模式(0: 不需要切换巡航状态1: 要切换巡航状态)
#define			ControllerCruiseHoldFlag					FirstControllerSetAddr.bits.b1          		//巡航保持，置位巡航保持中
#define			ControllerLimitSpeedFlag					FirstControllerSetAddr.bits.b2          		//控制器限速状态，置位超出限速值
#define			ControllerCruiseModeFlag					FirstControllerSetAddr.bits.b3          		//控制器巡航方式标志，置位长按巡航
#define			ControllerConnectFailFlag					FirstControllerSetAddr.bits.b4							//仪表没接收到控制器的数据，通讯故障标志，置位通讯故障
#define			ControllerLightFlag								FirstControllerSetAddr.bits.b5							//大灯设置，置位开灯
#define			ControllerStartModeSetFlag				FirstControllerSetAddr.bits.b6							//启动方式，置位非零启动,(需要保存状态)
#define			ControllerWorkStateFlag						FirstControllerSetAddr.bits.b7							//控制器状态，置位控制器工作

extern union		byte_def											SecondControllerSetAddr;										//控制器设置2
#define			SecondControllerSetByte						SecondControllerSetAddr.byte                //NC
//#define			ControllerCruiseChangeSetFlag			SecondControllerSetAddr.bits.b0          	//NC
//#define			ControllerCruiseHoldFlag					SecondControllerSetAddr.bits.b1          	//NC
//#define			ControllerLimitSpeedFlag					SecondControllerSetAddr.bits.b2          	//NC
//#define			ControllerCruiseModeSetFlag				SecondControllerSetAddr.bits.b3          	//NC
//#define			ControllerConnectFailFlag					SecondControllerSetAddr.bits.b4						//NC
//#define			ControllerLightSetFlag						SecondControllerSetAddr.bits.b5						//NC
#define			ControllerAutoCruiseFlag					SecondControllerSetAddr.bits.b6							//自动巡航标志0: 关闭1: 开启
#define			ControllerReverseStateFlag				SecondControllerSetAddr.bits.b7							//控制器倒车状态，置位控制器倒车

extern union		byte_def											FirstControllerStateAddr;										//控制器状态1
#define			FirstControllerStateByte					FirstControllerStateAddr.byte               //
#define			Cruise_6KM_StateFlag							FirstControllerStateAddr.bits.b7          	//6Km 巡航状态，置位巡航状态
#define			MotorHallErrorStateFlag						FirstControllerStateAddr.bits.b6          	//电机霍尔故障，置位故障
#define			HandleBarErrorStateFlag						FirstControllerStateAddr.bits.b5          	//控制器端的转把故障，置位故障
#define			ControllerErrorStateFlag					FirstControllerStateAddr.bits.b4          	//控制器故障，置位故障
#define			LowVoltageStateFlag								FirstControllerStateAddr.bits.b3						//控制器欠压保护，置位欠压保护
#define			CruiseStateFlag										FirstControllerStateAddr.bits.b2						//巡航状态，置位巡航（和上面的6km巡航不是一个）
//#define			ControllerStartModeSetFlag				FirstControllerStateAddr.bits.b1					//NC
#define			MotorFaultPhaseStateFlag					FirstControllerStateAddr.bits.b0						//电机缺相故障，置位缺相

extern union		byte_def											SecondControllerStateAddr;									//控制器状态2
#define			SecondControllerStateByte					SecondControllerStateAddr.byte              //
#define			BikeHorizontalStateFlag						SecondControllerStateAddr.bits.b7          	//车是否处于水平状态，置位水平状态
#define			AssistSensorStateFlag							SecondControllerStateAddr.bits.b6          	//助力传感器状态，置位助力传感器故障
#define			BrakeStateFlag										SecondControllerStateAddr.bits.b5          	//刹车状态，置位刹车
#define			InstrumentConnectFailFlag					SecondControllerStateAddr.bits.b4          	//控制器没接收到仪表的数据，通讯故障标志，置位通讯故障
#define			BatteryChargeFlag									SecondControllerStateAddr.bits.b3						//充电状态，置位充电中国
//#define			ControllerLightSetFlag						SecondControllerStateAddr.bits.b2					//NC
//#define			ControllerAutoCruiseFlag					SecondControllerStateAddr.bits.b1					//NC
//#define			ControllerReverseStateFlag				SecondControllerStateAddr.bits.b0					//NC


/* bdata  area */
extern unsigned char bdata ucFlag20;
extern bit 		Timer_1mS_CycleFlag; 			
extern bit 		PowerKeyShortPressFlag; 		
extern bit 		UpKeyShortPressFlag;			
extern bit 		DownKeyShortPressFlag;
extern bit 		PowerKeyLongPressFlag;		
extern bit 		UpKeyLongPressFlag;		
extern bit 		DownKeyLongPressFlag;				
extern bit 		KeyReleaseFlag;	

extern unsigned char bdata ucFlag21;
extern bit 		PowerKeyLongPressBackupFlag; 			
extern bit 		UpAndDownKeyLongPressFlag; 		
extern bit 		UpAndDownKeyLongPressBackupFlag;			
extern bit 		HandleBarSampleFinishFlag;		
extern bit 		UartReceivedFlag; 			
extern bit 		RefreshDisplayFlag; 		
extern bit 		KMH_OR_MPH_Flag;			
extern bit 		FunctionSetSaveFlag;	

extern unsigned char bdata ucFlag22;
extern bit 		FunctionSetFlag; 			
extern bit 		FunctionSetFlashFlag; 		
extern bit 		UpKeyLongPressBackupFlag;			
extern bit 		DownKeyLongPressBackupFlag;		
extern bit 		SleepTimeFlag; 			
extern bit 		HandleBarErrorFlag; 		
//extern bit 		KMH_OR_MPH_Flag;			
//extern bit 		FunctionSetSaveFlag;

extern unsigned char							U8_KeyValue ;																						//键值
extern unsigned char							U8_KeyValueBakcup;																			//电源键值
extern unsigned char							U8_UartReceiveCount;																		//接收字节数计数器
extern unsigned char							U8_UartReceiveTimeOverCount;														//接收超时计数器
extern unsigned char							U8_ConversionChannelIndex;															//ADC转换通道索引
extern unsigned char							U8_DIS_ODO_VOL_Index;																		//单次里程=0，总里程=1，电压=2
extern unsigned char							U8_FunctionMenuIndex;																		//
extern unsigned char							U8_SpeedDisplay;																				//车速
extern unsigned char							U8_VoltageOffset;																				//电池电压偏移量，用于调整电压误差
extern unsigned char							U8_BatteryCellVoltage;																	//电池图标的每格电压值
extern unsigned char							U8_BatteryCellNumber;																		//电池图标电量格数
extern unsigned char							U8_Gear_State;																					//档位，默认为1档
extern unsigned char							U8_BlacklightClass;																			//背光等级
extern unsigned char							U8_Blacklight_PWM_Value;																//背光亮度
extern unsigned char							U8_RatedVoltageValue;																		//额定电压默认为36v
extern unsigned char							U8_SleepTimeValue;																			//休眠时间值
extern unsigned char							U8_SleepTimeCount;																			//休眠计数器
extern unsigned char							U8_SpeedMeasureMagnetNumber;														//测速磁钢数
extern unsigned char							U8_LimitSpeedValue;																			//限速值
extern unsigned char							U8_DriveTypeValue;
extern unsigned char							U8_AssistSensitivityValue;															//助力灵敏度
extern unsigned char							U8_AssistStartClassValue;																//助力启动强度度
extern unsigned char							U8_AssistMagnetTypeSelect;															//助力磁盘类型选择
extern unsigned char							U8_AssistMagentNumberValue;															//助力磁钢数
extern unsigned char							U8_WorkCurrentValue;																		//工作电流
extern unsigned char							U8_OdographSaveAddressOffset;														//里程数保存地址偏移量

extern unsigned char							U8_UartSendData[20];																		//
extern unsigned char							U8_UartReceiveDataBuffer[14],														//
																	U8_UartReceiveData[14];																	//
extern unsigned int								U16_HandleBarBuffer[5];																	//使用5个字节做转把电压缓存，
	
extern const unsigned char 				LCD_Code[];																							//
extern unsigned char							U8_DisplayUnit,
																	U8_DisplayTen,
																	U8_DispalyHundred,
																	U8_DisplayThousand,
																	U8_DisplayTenThousand;																	//数码字个十百千万位显示值	
																	
extern unsigned int								U16_HandelbarVoltage,																		//转把电压
																	U16_HandleTo_PWM_Duty,																	//转把电压转换成PWM百分比，
																	U16_ACC_Voltage,																				//电门锁电压
																	U16_PowerVoltage,																				//电源电压
																	U16_DistanceNumber,																			//单次里程数
																	U16_OdographNumber,																			//里程数																	
																	U16_ADC_ResultBuffer;																		//ADC采样结果缓存
																	
extern unsigned int								U16_ParameterValueStep;																	//参数调节的步进，没按一次增量或减量值加1或减1
extern unsigned int								U16_ParameterValueStepBackup;														//																	
extern unsigned int								U16_ParameterValueShowIndex;														//在功能区数码管上显示的参数设置值
extern unsigned int								U16_LowVoltageValue;																		//欠压值，定点显示所以比实际值大10倍
extern unsigned int								U16_WheelDiameterValue;																	//轮径值，定点显示所有比实际值大10倍
extern unsigned int								U16_SetStateSilencePeriod;																	//																				
#endif 


/**********************SINOWEALTH_SH79F083A**********END OF FILE*************************/
